package router

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"server/internal/app/middleware"
)

// InitRouter 初始化全部路由
func initRouter(r *gin.Engine) {

	CommonApi(r)      //公共
	AdminNoneLogin(r) //不验证登录
	AdminNoneAuth(r)  //验证登录 不鉴权
	AdminRouter(r)    //鉴权

}

// InitRouter 初始化静态路由
func InitRouter(r *gin.Engine) *gin.Engine {
	r.Use(middleware.Cors())        //初始化跨域方法
	r.Static("/public", "./public") //初始化public文件夹的路由
	r.StaticFS("/administrator", http.Dir("dist"))
	r.StaticFS("/daping", http.Dir("daping/dist"))
	r.StaticFile("/MP_verify_AXCibyvJY8VWhqHi.txt", "./public/MP_verify_AXCibyvJY8VWhqHi.txt") //初始化public文件夹的路由
	initRouter(r)                                                                              //初始化路由
	return r

}
